<?php
namespace app\company\logic;

use think\Controller;

class User extends Controller{

    static public $notCheckPermissionArr = [
        "Index/index",
        "Index/test",
        "Index/rewardtotal",
        "User/check_login",
        "User/login_out",
//        "User/edit",
        "User/user_set",//用户个人设置
        "User/update_pass",//修改密码
        "User/delete_role_user",//删除角色用户
        "User/add_role_user",//新增角色用户
        "User/add_role_store",//新增角色用户
        /*系统管理*/
        "Permission/prize_add",
        "Permission/user_edit",
        "Permission/user_del",
        "Permission/overall_edit",
        "Permission/prize_buckle_import",
        "Role/role_import",
        "Role/delete_role_user",
        /*弹窗接口*/
        'Base/base_department_page',
        'Base/base_department_per',
        'Base/base_event_change',
        'Base/base_event_child',
        'Base/base_integral_cate',
        /*任务大厅*/
        'Task/index_take',
        'Task/task_info',
        'Task/audit_send',
        'Task/audit_notice',
        'Task/audit_pass_list',
        'Task/notice_pass_list',
        'Task/audit_reject_list',
        'Task/notice_reject_list',
        'Task/audit_withdraw_list',
        'Task/notice_withdraw_list',
        'Task/audit_pass',
        'Task/notice_pass',
        'Task/audit_reject',
        'Task/notice_reject',
        'Task/audit_withdraw',
        'Task/notice_withdraw',
        'Task/audit_edit',
        'Task/audit_sub',
        'Task/audit_del',
        'Task/lobby_notice',
        'Task/notice_info',
        'Task/issue_store',
        'Task/issue_notice_edit',
        'Task/issue_edit',
        /*积分配置*/
        'Sys/index_edit',
        'Sys/default_point_edit',
        /*组织机构*/
        'Organization/organization_edit',
        'Organization/organization_del',
        'Organization/staff_add',
        'Organization/staff_del',
        'Organization/staff_edit',
        'Organization/staff_import',
        /*积分管理*/
        'Integral/index_edit',
        'Integral/index_check_edit',
        'Integral/index_take',
        'Integral/audit_sub',
        'Integral/audit_del',
        'Integral/audit_withdraw_list',
        'Integral/audit_edit',
        'Integral/audit_urge',
        'Integral/audit_withdraw',
        'Integral/myinte',
        'Integral/myinteTabRChang',
        'Integral/event_info',
        'Integral/my_audit',
        'Integral/audit_pass_list',
        'Integral/audit_reject_list',
        'Integral/audit_pass',
        'Integral/audit_reject',
        'Integral/reward_libaray',
        'Integral/reward_libaray_item',
        'Integral/reward_libaray_item_explode',
        'Integral/by_condition',
        'Integral/daily_export',
        'Integral/activity_cate',
        'Integral/activity_del',
        'Integral/fixed_cate',
        'Integral/fixed_edit',
        'Integral/fixed_del',
        'Integral/fixed_user',
        'Integral/fixed_user_edit',
        'Integral/fixed_user_del',
        'Integral/event_change',
        'Integral/activity_del',
        'Integral/activity_move',
        'Integral/fixed_cate_edit',
        'Integral/cate_edit',
        'Integral/cate_del',
        'Integral/fixed_cate_del',
        'Integral/fixed_user_store',
        'Integral/fixed_import',
        'Integral/daily_2021',
        'Integral/daily',
        'Integral/event_info_2021',
        'Integral/by_condition_2021',
        'Integral/by_condition_2021_export',
        'Integral/daily_2021_export',
        'Integral/daily_2022',
        'Integral/event_info_2022',
        'Integral/by_condition_2022',
        'Integral/by_condition_2022_export',
        'Integral/daily_2022_export',
        /*核查结算*/
        'Review/staff',
        'Review/index',
        /*统计排名*/
        'Reportset/index_add',
        'Reportset/index_edit',
        'Reportset/index_del',
        'Reportset/index_staff',
        'Reportset/index_select_lay',
        'Reportset/index_staff_del',
        'Reportset/index_staff_import',
        'Reportset/down_exl',
        'Reportset/custom_report_ranking',
        'Reportset/integral_rank_ranking',
        'Reportset/manage_report_ranking',
        'Reportset/index_select_lay_sub',
        'Reportset/index_staff_update',
        'Reportset/index_staff_del',
        /*奖票管理*/
        'Ticket/printer',
        'Ticket/printerupdate',
        'Ticket/update_status',
        'Ticket/index',
        'Ticket/activity_draw',//抽奖
        'Ticket/activity_edit',//编辑
        'Base/base_event_cate',//事件分类列表
        /*奖扣任务*/
        'Awardtask/config_edit',
        'Awardtask/change_status',
        'Awardtask/add_user_list',
        'Awardtask/add_user_submit',
        'Awardtask/del_next_user',
        'Awardtask/del_user_list',
        'Awardtask/del_user_submit',
        'Awardtask/config_next_edit',
        'Awardtask/config_users_page',

    ];
    //判断用户是否有该权限，ClientUser/delete,delete_one
    static public function checkHasPermission($rule){
        $hasPermissionsArr = session("hasPermissionsArr");
        if(
            !empty($hasPermissionsArr) &&
            !in_array($rule,$hasPermissionsArr) &&
            !in_array($rule,self::$notCheckPermissionArr)
        ){
            return false;
        }
        return true;
    }
}
